﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace TimeQuest
{
    public class ContentHandler
    {
        private static Dictionary<int, SpriteFont> Fonts = new Dictionary<int, SpriteFont>();

        public static int AddFont(SpriteFont t)
        {
            int? newId = Fonts.Where(x => x.Key == Fonts.Max(y => y.Key)).Select(x => x.Key).SingleOrDefault();
            if (newId.HasValue)
                Fonts.Add((int)newId, t);
            return (int)newId;
        }

        public static SpriteFont GetFont(int ID)
        {
            if (Fonts.ContainsKey(ID))
                return Fonts[ID];
            else
                return null;
        }


        private static Dictionary<int, Texture2D> Textures = new Dictionary<int, Texture2D>();

        public static int AddTexture(Texture2D t)
        {
            int? newId = Textures.Where(x => x.Key == Textures.Max(y => y.Key)).Select(x => x.Key).SingleOrDefault() + 1;
            if (newId.HasValue)
                Textures.Add((int)newId, t);
            return (int)newId;
        }

        public static Texture2D GetTexture(int ID)
        {
            if (Textures.ContainsKey(ID))
                return Textures[ID];
            else
                return null;
        }
    }
}
